rm(list = ls())
rerun_llm <- FALSE

setwd(
 # ENSURE CORRECT WORKING DIRECTORY
)

# Custom Packages
source("code/0a_qval.R")
source("code/0a_dups.R")
source("code/0a_trackr.R")


# Functions
source("code/0b_functions.R", echo = TRUE)
source("code/0c_functions_lasso.R")
source("code/0d_ri_functions.R")

# DATA PREPARATION
#source("code/1_import.R", echo = TRUE) # For Data Editor - Only include for non-anonymised data
source("code/2_prep_dfs.R", echo = TRUE)
source("code/3_results_prep.R")

# MAIN TABLES AND FIGURES
source("code/4_results_main.R", echo = TRUE)
source("code/5_results_videos.R", echo = TRUE)
source("code/6_follow_up.R", echo = TRUE)
source("code/7_results_mechs.R", echo = TRUE)

# APPENDIX TABLES AND FIGURES
source("code/8_results_appendix.R", echo = TRUE) #check readme note
source("code/9_results_mechs_discussion.R", echo = TRUE)
source("code/10_results_descriptives.R", echo = TRUE)


source("code/11_balance.R", echo = TRUE)
source("code/12_protocol_fidelity.R", echo = TRUE)
source("code/13_weighting.R", echo = TRUE)


source("code/14_export_lasso_controls.R", echo = TRUE)
source("code/15_discussion_dynamics.R", echo = TRUE)
source("code/16_photo_rating_survey.R", echo = TRUE)


# TRANSCRIPTS
#source('code/17_import_transcripts.R', echo = TRUE) # For Data Editor - Only include for pre-translated transcripts
if (rerun_llm) source("code/18_generate_embeddings.py", echo = TRUE)
source("code/19_analyse_transcripts.R", echo = TRUE)
source("code/20_analyse_embeddings.R", echo = TRUE)
source("code/21_het_by_posneg_discussion.R", echo = TRUE)
if (rerun_llm) source("code/22_llm_rate_transcripts.R", echo = TRUE)
source("code/23_analyse_transcript_morality.R", echo = TRUE)
if (rerun_llm) source("code/24_ml_hypothesis_generation.R", echo = TRUE)
source("code/25_ml_hypothesis_process.R", echo = TRUE)
source("code/26_discussion_debrief.R", echo = TRUE)

source("code/27_intensity_pref.R", echo = TRUE)

#system("say DONE")